"""Definition of the recruitinfo content type
"""

from zope.interface import implements

from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata

# -*- Message Factory Imported Here -*-
from my315ok.xtinfocontent import xtinfocontentMessageFactory as _

from my315ok.xtinfocontent.interfaces import Irecruitinfo
from my315ok.xtinfocontent.config import PROJECTNAME

recruitinfoSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-

       atapi.StringField(
        'category',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"position category"),
            description=_(u""),
        ),
    ),

    atapi.StringField(
        'worktype',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"work type"),
            description=_(u""),
        ),
        required=True,
    ),


  
    atapi.FixedPointField(
        'salary',
        storage=atapi.AnnotationStorage(),
        widget=atapi.DecimalWidget(
            label=_(u"salary"),
            description=_(u""),
        ),
        validators=('isDecimal'),
    ),


    atapi.IntegerField(
        'num',
        storage=atapi.AnnotationStorage(),
        widget=atapi.IntegerWidget(
            label=_(u"recruit number"),
            description=_(u""),
        ),
        validators=('isInt'),
    ),
    atapi.StringField(
        'speciality',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"speciality"),
            description=_(u""),
        ),
    ),


    atapi.StringField(
        'education',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"education"),
            description=_(u""),
        ),
    ),




   atapi.TextField(
        'text',
        storage=atapi.AnnotationStorage(),
        widget=atapi.RichWidget(
            label=_(u"company introduction"),
            description=_(u"company and position introduction"),
        ),
        required=True,
    ),


))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

recruitinfoSchema['title'].storage = atapi.AnnotationStorage()
recruitinfoSchema['description'].storage = atapi.AnnotationStorage()

schemata.finalizeATCTSchema(recruitinfoSchema, moveDiscussion=False)


class recruitinfo(base.ATCTContent):
    """recruit information"""
    implements(Irecruitinfo)

    meta_type = "recruitinfo"
    schema = recruitinfoSchema

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    text = atapi.ATFieldProperty('text')

    worktype = atapi.ATFieldProperty('worktype')

    speciality = atapi.ATFieldProperty('speciality')

    education = atapi.ATFieldProperty('education')

    salary = atapi.ATFieldProperty('salary')

    num = atapi.ATFieldProperty('num')

    category = atapi.ATFieldProperty('category')


atapi.registerType(recruitinfo, PROJECTNAME)
